package com.wmccn.platform.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.util.Properties;

public class PropertyUtil {
	private Properties props = new Properties();

	public PropertyUtil(String path) {
		String canonicalPath = "";
		try {
			canonicalPath = this.getClass().getResource("/").toURI().getPath();
//			canonicalPath = new File(canonicalPath).getParentFile()
//					.getParentFile().getCanonicalPath();
			InputStream in = new FileInputStream(new File(canonicalPath +File.separator+ path));
			props.load(in);
		} catch (URISyntaxException e1) {
			e1.printStackTrace();
		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}

	public String getProperty(String name) {
		return props.getProperty(name);
	}
}
